﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SharpICTCLAS;

namespace DisposeText
{
    /// <summary>
    /// 分词基础类，基于ICTCLAS构建
    /// </summary>
    public class WordSegmentSolve
    {
        private int nKind = 1;  //在NShortPath方法中用来决定初步切分时分成几种结果
        private WordSegment wordSegment;

        /// <summary>
        /// 构造函数，在没有指明nKind的情况下，nKind 取 1
        /// </summary>
        /// <param name="dictPath"></param>
        public WordSegmentSolve(string dictPath) : this(dictPath, 1) { }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dictPath"></param>
        /// <param name="nKind"></param>
        public WordSegmentSolve(string dictPath, int nKind)
        {
            this.nKind = nKind;
            this.wordSegment = new WordSegment();
            wordSegment.InitWordSegment(dictPath);
        }

        /// <summary>
        /// 分词
        /// </summary>
        /// <param name="sentence"></param>
        /// <returns></returns>
        public List<WordResult[]> Segment(string sentence)
        {
            return wordSegment.Segment(sentence, nKind);
        }
    }
}
